﻿using System;
using System.Collections.Generic;
using System.Text;
using EasyToHelp.DBFactory;
using EasyToHelp.Entity;
using Newtonsoft.Json;

namespace EasyToHelp.Service
{
    public class SysMenusService : ISysMenusService
    {
        public List<SysMenus> GetChildrenSysMenusList(int PId)
        {
            var list = new List<SysMenus>();
            using (var db = ContextHelper.Context(ContextHelper._connString))
            {
                list = db.Query<SysMenus>().Where(x => x.PId == PId).ToList();
            }
            return list;
        }
        /// <summary>
        /// 获得初始化菜单数据
        /// </summary>
        /// <returns></returns>
        public List<SysMenus> GetSysMenus()
        {
            var list = new List<SysMenus>();
            using (var db = ContextHelper.Context(ContextHelper._connString))
            {
                list = db.Query<SysMenus>().Where(x => x.PId == 0).ToList();
            }
            return list;
        }
    }
}
